package com.wxy.ej.flow.modules.taskflow.service.nodeExecuteStrategy.strategy.code;

import com.alibaba.fastjson.JSONObject;
import com.rt.easyjava.common.base.Result;
import com.wxy.ej.flow.modules.taskflow.dto.DataDto;
import com.wxy.ej.flow.modules.taskflow.dto.NodeDto;
import com.wxy.ej.flow.modules.taskflow.service.nodeExecuteStrategy.NodeStrategy;
import lombok.extern.slf4j.Slf4j;

@Slf4j
public class CodeJsCodeNodeStrategy extends NodeStrategy {

    @Override
    public Result action(NodeDto node, JSONObject flowDataJson, DataDto dataDto) throws Exception {
        log.info("Code-JsCode-NodeStrategy");

        String jsScript = node.getScript();
        executeScripts(dataDto, jsScript);


        /*List<String> jsCodeList = Arrays.asList(jsCodes.split(";"));
        for(String script:jsCodeList) {
            if (StringUtils.isNull(script)) continue;
            // execute
            Object o = executeScript(dataDto, script);
            System.out.println(o);
        }*/


        return Result.builder();
    }

}
